
	/************************************************************************************************

		Liquid runtime
		
		Introspection:			
			b		isAugmented											(v)														- sid: 5.0
			b		isArray													(v)														- sid: 5.0
			b		isArrayLike											(v)														- sid: 5.0
			b		isBoolean												(v)														- sid: 5.0
			b		isClass													(v)														- sid: 5.0
			b		isDate													(v)														- sid: 5.0
			b		isError													(v)														- sid: 5.0
			b		isFunction											(v)														- sid: 5.0
			b		isInteger												(v)														- sid: 5.0
			b		isInterface											(v)														- sid: 5.0
			b		isModule												(v)														- sid: 5.0
			b		isNumber												(v)														- sid: 5.0
			b		isObject												(v)														- sid: 5.0
			b		isRegExp												(v)														- sid: 5.0
			b		isString												(v)														- sid: 5.0
			b 	isSubTypeOf											(type, type2)									- sid: 5.0
			b 	isSuperTypeOf										(type, type2)									-	sid: 5.0
		
		System messages:
			mod	setMessage											(id, msg)											- sid: 5.0		
			msg	getMessage											(id)													- sid: 5.0
			msg	compileMessage									(id, params..*)								- sid: 5.0						
		
		Errors:						
			mod	defineError											(name, super*, msg*)					- sid: 5.0
					throwError											(e, cx*, args*)								-	sid: 5.0
		
		Debug:
			mod	defineValidationRule						(id, rule)										-	sid: 5.0
			mod	validate												(v, id, param*, error*)				-	sid: 5.0
		
		Validation rules:
			Numbers:
				n, n+, n++, N, N+, N++
				i, i+, i++, I, I+, I++
			Others:			
				al, b, class, e, enum, interface, f, o, qid, re, url, s, s+
			Composite:
				al|i, al|s, b|f, b|n+, b|s+, e|f, f|s+, i+|s+, n+|s+, re|s+
		
		Private (micro-lang):						
			a		__mlang.array_unique						(options)													
			b		__mlang.array_contains					(v)
				
			s		__mlang.function_getParameters	()
			s		__mlang.function_getBody				()
			s		__mlang.function_getName				()	
																					
	************************************************************************************************/
 
	//@sys: v8cgi 0.9 - implicit define. If used var jsl, in for/in loop of the global object this, 
	//			is throwed an internal error 
	jsl																		= {}
	jsl.__magic														= "J345NN48H756PQ56"
	jsl.__version													= "0.47"
	jsl.__error														= null
	
	//@sys: v8cgi 0.9 - why not only 'this'? because v8cgi give some error ex: typeof this["jsl"] inside a fun
	jsl.__go															= (function() { return this })()
	jsl.__stype														= null	
			
  jsl.__vars                         	 	= {}      
  jsl.__vars.tmp                     	 	= {}      
  jsl.__vars.re     										= {}	
	
  jsl.__vars.f     											= function(){}
  jsl.__vars.re.id  										= /^[a-zA-Z_\$][\w\$]*$/
  jsl.__vars.re.qid 										= /^[a-zA-Z_\$][\w\$]*(\.[a-zA-Z_\$][\w\$]*)*$/
	jsl.__vars.re.urn											=	/^[a-zA-Z_\$][\w\$]*(\.[a-zA-Z_\$][\w\$]*)*$/
  jsl.__vars.re.url 										= /^((app:|file:\/\/|ftp:\/|http:\/|https:\/)\/)(\w+:?\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/i 
  jsl.__vars.re.lurl 										= /^((file:\/|[a-zA-Z_\$][\w\$]*(\.[a-zA-Z_\$][\w\$]*)*:)\/\/)(\w+:?\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/i 

	jsl.__mods														= [ "jsl" ]
	jsl.__wkmods													= [ "locale", "encode", "storage", "timer", "crypto", "jsunit", "gi" ]
	jsl.__wkmods["locale"]								= true	
	jsl.__wkmods["encode"]								= true	
	jsl.__wkmods["storage"]								= true	
	jsl.__wkmods["timer"]									= true	
	jsl.__wkmods["crypto"]								= true	
	jsl.__wkmods["jsunit"]								= true	
	jsl.__wkmods["gi"]										= true	
	
	jsl.__libs														= []
	jsl.__wklibs													= [ "lang" ]
	jsl.__wklibs["lang"]									= true
	jsl.__errs														= []
	
	jsl.__signatures											= {}
	jsl.__signatures["jsl.Class"]					= "A7ISX0CC0K1PZN3J"
	jsl.__signatures["AdobeAIR"]					= "A98UY35UT46R76K7"	

  jsl.__objs														= {}
  jsl.__msgs 														= {}
  jsl.__vrules                      	  = {}      	
	jsl.__mlang														= {}
  		
	//in case of error before is created the jsl module
	//-------------------------------------------------------------------------------
	jsl.getName = function() { return "Jsl" }
	
	//Introspection:
	//-------------------------------------------------------------------------------
	jsl.isAugmented = function(v) {
		try {//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()//@d]
			return v != null && !!v.__augmented
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isArray = function(v) {
		try {//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()//@d]
			return v instanceof Array
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isArrayLike = function(v) {
		try {
			var rv
			//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()//@d]

			rv = v instanceof Array

			if(!rv) 
				rv = jsl.isObject(v) && v.length >= 0 && jsl.isInteger(v.length) && !jsl.isString(v) && !jsl.isFunction(v) 

			return rv
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isBoolean = function(v) {
		try {//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()//@d]
			return typeof v === "boolean" || v instanceof Boolean
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isClass = function(v) {
		try {//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()//@d]
			return v instanceof Function && v.__signature === jsl.__signatures["jsl.Class"]
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isDate = function(v) {
		try {//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()//@d]
			return v instanceof Date
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isError = function(v) {
		try {//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()//@d]
			return v instanceof Error
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isFunction = function(v) {
		try {//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()//@d]
			//v instanceof Function
			//@sys: Explorer 8 - RangeError is not instanceof Function
			//@sys: WebKit typeof /regexp/ = 'function' -> sugar syntax: /hello/("string") -> /hello/.exec("string")
			return (typeof v === "function" && !(v instanceof RegExp)) || (v instanceof Function)
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isInteger = function(v) {
		try {//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()//@d]
			return (typeof v === "number" || v instanceof Number) && !isNaN(v) && isFinite(v) && v - ~~v === 0
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isInterface = function(v) {
		try {//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()//@d]
			return v instanceof jsl.Interface
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isModule = function(v) {
		try {//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()//@d]
			return v instanceof jsl.Module
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isNumber = function(v) {
		try {//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()//@d]
			return typeof v === "number" || v instanceof Number
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isObject = function(v) {
		try {//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()//@d]

			//v instanceof Object
			//@sys: Firefox 3.5.6 - window instanceof Object -> false but typeof window === "object" -> true
			return v instanceof Object || (v != null && typeof v === "object")
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isRegExp = function(v) {
		try {//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()//@d]
			return v instanceof RegExp
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isString = function(v) {
		try {//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()//@d]
			return typeof v === "string" || v instanceof String
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isSubTypeOf = function(type, type2) {
		try {//@d[
			if(arguments.length !== 2)	throw jsl.ParamError()
			jsl.validate(type	, "f", "type")
			jsl.validate(type2, "f", "type2")//@d]
			
			return type2.prototype.isPrototypeOf(type.prototype)
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.isSuperTypeOf = function(type, type2) {
		try {//@d[
			if(arguments.length !== 2)	throw jsl.ParamError()
			jsl.validate(type	, "f", "type")
			jsl.validate(type2, "f", "type2")//@d]
			
			return type.prototype.isPrototypeOf(type2.prototype)
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
	//Messages:
	//-------------------------------------------------------------------------------
	jsl.setMessage = function(id, msg) {
  	try {		
			//@d[
			var oldv, v, re1, re2, l
		
			if(arguments.length !== 2)			throw jsl.ParamError()			
			jsl.validate(id	, "qid"	, "id")
			jsl.validate(msg, "s+"	, "msg")
			
			//replace with _ not with '' -> the replace creates new string pattern \\$$ -> \$ error!
			v = msg.replace(/\\\$/g, "_")
			l = v.match(/\$\?/g)		
			if(l && l.length > 1)	throw jsl.ParamError("BadNumberOf:msg:$?")
			
			oldv = jsl.__msgs[id]
			
			if(oldv) { 
				oldv 	= oldv.replace(/\\\$/g, "_")
				re1		= /\$\?/
				re2		= /\$((?!\\?)|$)/g
				
				if((oldv.match(re1) || []).length !== (v.match(re1) || []).length)	throw jsl.ParamError("BadNumberOf:message:$?")
				if((oldv.match(re2) || []).length !== (v.match(re2) || []).length)	throw jsl.ParamError("BadNumberOf:message:$")

				v			= v.replace		(/\$\?[\s\S]*/, "") 
				oldv 	= oldv.replace(/\$\?[\s\S]*/, "")
				if((oldv.match(re2) || []).length !== (v.match(re2) || []).length)	throw jsl.ParamError("BadNumberOf:message:$")
			}
			//@d]

			jsl.__msgs[id] = msg + ""
			return this					
  	}
  	catch(e) {
  		jsl.throwError(e, this, arguments)
  	}
  }
	//-------------------------------------------------------------------------------
	jsl.getMessage = function(id) {
		try {//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()
			jsl.validate(id, "qid", "id")
			if(!jsl.__msgs[id])	throw jsl.ParamError("NotDefined:id")//@d]
			
			return jsl.__msgs[id] 
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)
		}
	}
  //-------------------------------------------------------------------------------
	jsl.compileMessage = function(id) {
  	try {
 			var a, params, msg, l, n1, n2, idx
			
			//@d[
  		if(arguments.length < 2)		throw jsl.ParamError()
			jsl.validate(id, "s+", "id")//@d]
												
			for(params = [], a = 1; a < arguments.length; a++) params = params.concat(arguments[a])
			
			msg	= (jsl.__msgs[id] || id).replace(/\\\$/g, "__") 
			l 	= msg.match(/\$\?/g)			
			if(l && l.length > 1)	throw jsl.ParamError("BadNumberOf:id:$?")
			
			n1 = msg.match(/\$((?!\?)|$)/g)
			n1 = n1 ? n1.length : 0
			
			n2 = msg.replace(/\$\?[\s\S]*/, "").match(/\$/g)
			n2 = n2 ? n2.length : 0

			if(params.length !== n1 && params.length !== n2)	throw jsl.ParamError()
			
			idx	= msg.search(/\$\?/)
			msg	= jsl.__msgs[id] || id
			
			if(idx !== -1)			
				if(params.length === n1)	msg = msg.slice(0, idx) + msg.slice(idx + 2) 
				else											msg	= msg.slice(0, idx)
				
			a		= 0
			msg	= msg.replace(/\\\$|\$/g,
				function(token, idx) {
					
					if(token === "\\$")			token	= "$"
					else if(token === "$")	token = params[a++]
						
	  			return token
	  		})
							
  		return msg			
  	}
  	catch(e) {
	  	jsl.throwError(e, this, arguments)
  	}
  }	
	//Errors:
	//-------------------------------------------------------------------------------
	jsl.defineError = function(name, $super, msg) {
		try {
      var error, objs, obj
      
			//@d[
      if(!arguments.length || arguments.length > 3)	throw jsl.ParamError()			
			jsl.validate(name, "qid", "name")		
			if(jsl.__errs[name])	throw jsl.ParamError("AlreadyDefiend:	name")//@d]
			
			objs 	= name.split(".")													
			obj 	= jsl.__go
			
			for(var a = 0; a < objs.length - 1; obj = obj[objs[a]], a++)//@d[ 				
				if(!jsl.isObject(obj[objs[a]]))	throw jsl.ParamError("BadValue:name")//@d]
				;//<-do not remove		
			
			//@d[	
			if(arguments.length >= 2) {				
				jsl.validate($super, "f", "super")
  	    if($super !== Error && !jsl.isSubTypeOf($super, Error))	throw jsl.ParamError("BadType:super:Error")
			}
																										
			if(arguments.length === 3) jsl.validate(msg, "s+", "msg")//@d]
			
			//-------------------------------------------------------------------------------
			error = function(p1, p2, p3) {
				try {
					//@d[
					if(arguments.length > (jsl.isArray(p2) ? 3 : 2)) 			throw jsl.ParamError()			
					if(arguments.length 			&& p1 == null)							throw jsl.ParamError("NullValue:msg")						
					if(arguments.length >= 2	&& p2 == null)							throw jsl.ParamError("NullValue:" + (jsl.isArray(p2) ? "params" : "cause"))							
					if(arguments.length == 3 	&& p3 == null)							throw jsl.ParamError("NullValue:cause")
					//@d]
											
					if(this instanceof arguments.callee && !this.__created) {
																																					
            this.__error 			= new Error
						this.__name				= name
						this.__dmessage		= jsl.__msgs[arguments.callee.__dmessage] || arguments.callee.__dmessage
						this.__created		= true
						this.constructor 	= arguments.callee
						
						if(arguments.length === 1)			this.setMessage(p1)
						else if(jsl.isArray(p2))				this.setMessage(p1, p2)
						else if(arguments.length === 2)	this.setMessage(p1).setCause(p2)
						else if(arguments.length)				this.setMessage(p1, p2).setCause(p3)
          }
          else if(!arguments.length)			return new arguments.callee()
					else if(arguments.length === 1)	return new arguments.callee(p1)
					else if(arguments.length === 2)	return new arguments.callee(p1, p2)
					else														return new arguments.callee(p1, p2, p3)
					
					return this
				}
				catch(e) {
          jsl.throwError(e, jsl, arguments)
				}
			}
			//-------------------------------------------------------------------------------
			error.__name							= name
			error.__dmessage   				= arguments.length === 3 ? msg : null

      error.prototype						= jsl.Object.merge(new ($super || Error), jsl.Error.prototype)
			error.__native						= jsl.Error.__native.copy().merge(error.prototype)			
			error.__native.__dmessage	= undefined
			
			//@sys: Explorer 8.0.6 - the toString method is always not enumerable also if is setted
			error.prototype.toString	= jsl.Error.__native.toString 
										
			delete error.prototype.__created			
			//-------------------------------------------------------------------------------	
			obj[objs[a]] 							= error
			jsl.__errs[name]					= error
			jsl.__errs.push(error)					
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
  //-------------------------------------------------------------------------------
	jsl.throwError = function(e, cx, args) {
  	try {
  		var e2
			
			//@d[
			if(!arguments.length)	throw jsl.ParamError()
			if(arguments.length >= 2)
  			if(typeof cx === "string" ? arguments.length > 3 : arguments.length !== 3)	throw jsl.ParamError()
			//@d]
			
			if(arguments.length === 1)			e2 = jsl.Error(e)
			else if(arguments.length === 2)	e2 = jsl.Error(e).trace(cx)
			else														e2 = jsl.Error(e).trace(cx, args)			
  	}
  	catch(e3) {			
 			jsl.throwError(jsl.Error(e3, e), this, arguments)
  	}
		throw e2
  }
  
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule = function(id, rule) {
		try {
			var n
			
			//@d[
			if(arguments.length !== 2)	throw jsl.ParamError()
			if(id == null)							throw jsl.ParamError("NullValue:			id")
			if(!jsl.isString(id))				throw jsl.ParamError("BadType:				id:string")
			if(!id.length)							throw jsl.ParamError("EmptyString:		id")
			if(this.__vrules[id])				throw jsl.ParamError("AlreadyDefined:	id")
			if(rule == null)						throw jsl.ParamError("NullValue:			rule")
			if(!jsl.isFunction(rule))		throw jsl.ParamError("BadType:				rule:function")
			
			n = id.match(/\|/)
			n	= n ? n.length : 0
			if(n > 2)	throw jsl.ParamError("BadNumberOf:|")
			//@d]
			
			this.__vrules[id] = rule			
			if(id.indexOf("|") !== -1) this.__vrules[id.split("|")[1] + "|" + id.split("|")[0]] = rule
			
			return this
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.validate = function(v, rule, param, error) {
		try {
			//iparams -> inline params
			var params, id, idx, iparams 
			
			if(arguments.length < 2 || arguments.length > 4)	throw jsl.ParamError()
			if(rule == null)																	throw jsl.ParamError("NullValue:		rule")
			if(!jsl.isString(rule))														throw jsl.ParamError("BadType:			rule:string")
			if(!rule.length)																	throw jsl.ParamError("EmptyString:	rule")
			
			id 	= rule.match(/^[^\[\(\/\)\]]+/)[0]
			idx = rule.search(/\[|\(/)

			if(!this.__vrules[id])	throw jsl.ParamError("NotDefined", ["rule(" + id + ")"])
			
			if(idx !== -1 && rule.charAt(id.length) !== "/") {
				if(rule.search(/\]|\)/) !== rule.length - 1)	throw jsl.ParamError("BadSyntax", ["rule(" + id + ")"])
				iparams = rule.slice(idx + 1, -1).split(",")
			}			
			
			//tollerate an error = null. This is used in the jsl.Object factory at the clone method when is called at
			//the factory initialization. Inside the method, jsl.MisuseError is not yet defined			
			if(error != null)
				if(error !== Error && !Error.prototype.isPrototypeOf(error.prototype))	
																											throw jsl.ParamError("BadType:error:Error")			

			params 		= Array.prototype.slice.call(arguments)
			params[2] = arguments.length === 2 ? params[1] : param 
			params[3] = error ? error : jsl.ParamError 
			
			if(idx !== -1)
				params[4] = iparams
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
				
		this.__vrules[id].apply({}, params)		
		return this
	}	
	//Validation rules
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("a", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue"				, [ id ])
		if(!jsl.isArray(v))													throw error("BadType"					, [ id, "Array" ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("al", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue"				, [ id ])
		if(!jsl.isArrayLike(v))											throw error("BadType"					, [ id, "array-like" ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("b", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue"				, [ id ])
		if(!jsl.isBoolean(v))												throw error("BadType"					, [ id , "boolean" ])			
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("class", function(v, rule, id, error, params) {
		if(v == null)																throw error("NullValue"				, [ id ])
		if(!jsl.isClass(v))													throw error("BadType"					, [ id, "jsl.Class" ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("d", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue"				, [ id ])
		if(!jsl.isDate(v))													throw error("BadType"					, [ id , "Date" ])			
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("e", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue"				, [ id ])
		if(!jsl.isError(v))													throw error("BadType"					, [ id, "Error" ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("enum", function(v, rule, id, error, params) {
		
		for(var a = params.length - 1, b = false; a >= 0 && !b; a--)
			b = v == params[a]
			
		if(!b)																			throw error("BadValue"				, [ id, params.join(" | ") ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("interface", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue"				, [ id ])
		if(!jsl.isInterface(v))											throw error("BadType"					, [ id, "jsl.Interface" ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("i", function(v, rule, id, error, params) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isNumber(v))												throw error("BadType" 				, [ id, "number" ])
		if(isNaN(v))																throw error("NaNValue" 				, [ id ])
		if(!isFinite(v))														throw error("InfiniteNumber"  , [ id ])
		if(!jsl.isInteger(v))												throw error("NotInteger"			, [ id ])

		var n0, n1, le, ge
		
		if(params) {
			n0 = params[0] ? +params[0] : -Infinity
			n1 = params[1] ? +params[1] : +Infinity
			le = rule.indexOf("[") !== -1
			ge = rule.indexOf("]") !== -1
			
			if(params.length > 2)											throw error("BadValue"				, [ id ])
			if(isNaN(n0))															throw error("BadValue"				, [ id ])
			if(isNaN(n1))															throw error("BadValue"				, [ id ])
			if(params.length === 2 && n0 > n1)				throw error("BadValue"				, [ id ])
			
			if(le ? v < n0 : v <= n0)									throw error("BadValue"				, [ id ])
			if(ge	? v > n1 : v >= n1)									throw error("BadValue"				, [ id ])
		}		
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("i!0", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isNumber(v))												throw error("BadType" 				, [ id, "number" ])
		if(isNaN(v))																throw error("NaNValue" 				, [ id ])
		if(!isFinite(v))														throw error("InfiniteNumber"  , [ id ])
		if(!jsl.isInteger(v))												throw error("NotInteger"			, [ id ])
		if(v == 0)																	throw error("BadValue"				, [ id, id + " != 0" ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("i+", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isNumber(v))												throw error("BadType" 				, [ id, "number" ])
		if(isNaN(v))																throw error("NaNValue" 				, [ id ])
		if(!isFinite(v))														throw error("InfiniteNumber"  , [ id ])
		if(v < 0)																		throw error("NegativeNumber"	, [ id ])
		if(!jsl.isInteger(v))												throw error("NotInteger"			, [ id ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("i++", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isNumber(v))												throw error("BadType" 				, [ id, "number" ])
		if(isNaN(v))																throw error("NaNValue" 				, [ id ])
		if(!isFinite(v))														throw error("InfiniteNumber" 	, [ id ])
		if(v <= 0)																	throw error("BadValue"				, [ id, id + " > 0" ])
		if(!jsl.isInteger(v))												throw error("NotInteger"			, [ id ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("I", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isNumber(v))												throw error("BadType" 				, [ id, "number" ])
		if(isNaN(v))																throw error("NaNValue" 				, [ id ])
		if(isFinite(v) && !jsl.isInteger(v))				throw error("NotInteger"			, [ id ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("I+", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isNumber(v))												throw error("BadType" 				, [ id, "number" ])
		if(isNaN(v))																throw error("NaNValue" 				, [ id ])
		if(v < 0)																		throw error("NegativeNumber"	, [ id ])
		if(isFinite(v) && !jsl.isInteger(v))				throw error("NotInteger"			, [ id ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("I++", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isNumber(v))												throw error("BadType" 				, [ id, "number" ])
		if(isNaN(v))																throw error("NaNValue" 				, [ id ])
		if(v <= 0)																	throw error("NegativeNumber"	, [ id ])
		if(isFinite(v) && !jsl.isInteger(v))				throw error("NotInteger"			, [ id ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("f", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isFunction(v))											throw error("BadType" 				, [ id, "function" ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("n", function(v, rule, id, error, params) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isNumber(v))												throw error("BadType" 				, [ id, "number" ])
		if(isNaN(v))																throw error("NaNValue" 				, [ id ])
		if(!isFinite(v))														throw error("InfiniteNumber" 	, [ id ])		
		
		var n0, n1, le, ge
		
		if(params) {
			n0 = params[0] ? +params[0] : -Infinity
			n1 = params[1] ? +params[1] : +Infinity
			le = rule.indexOf("[") !== -1
			ge = rule.indexOf("]") !== -1
			
			if(params.length > 2)											throw error("BadValue"				, [ id ])
			if(isNaN(n0))															throw error("BadValue"				, [ id ])
			if(isNaN(n1))															throw error("BadValue"				, [ id ])
			if(params.length === 2 && n0 > n1)				throw error("BadValue"				, [ id ])
			
			if(le ? v < n0 : v <= n0)									throw error("BadValue"				, [ id ])
			if(ge	? v > n1 : v >= n1)									throw error("BadValue"				, [ id ])
		}		
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("n+", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isNumber(v))												throw error("BadType" 				, [ id, "number" ])
		if(isNaN(v))																throw error("NaNValue" 				, [ id ])
		if(!isFinite(v))														throw error("InfiniteNumber" 	, [ id ])
		if(v < 0)																		throw error("NegativeNumber"	, [ id ])		
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("n++", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isNumber(v))												throw error("BadType" 				, [ id, "number" ])
		if(isNaN(v))																throw error("NaNValue" 				, [ id ])
		if(!isFinite(v))														throw error("InfiniteNumber" 	, [ id ])
		if(v <= 0)																	throw error("BadValue"				, [ id, id + " > 0" ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("N", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isNumber(v))												throw error("BadType" 				, [ id, "number" ])
		if(isNaN(v))																throw error("NaNValue" 				, [ id ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("N+", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isNumber(v))												throw error("BadType" 				, [ id, "number" ])
		if(isNaN(v))																throw error("NaNValue" 				, [ id ])
		if(v < 0)																		throw error("NegativeNumber"	, [ id ])		
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("N++", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isNumber(v))												throw error("BadType" 				, [ id, "number" ])
		if(isNaN(v))																throw error("NaNValue" 				, [ id ])
		if(v <= 0)																	throw error("BadValue"				, [ id, id + " > 0" ])		
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("o", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isObject(v))												throw error("BadType" 				, [ id, "object" ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("qid", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isString(v))												throw error("BadType" 				, [ id, "string" ])
		if(!v.length)																throw error("EmptyString"			, [ id ])
		if(!jsl.__vars.re.qid.test(v)) 							throw error("BadQid"					, [ id ])         		
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("re", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isRegExp(v))												throw error("BadType" 				, [ id, "RegExp" ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("url", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isString(v))												throw error("BadType" 				, [ id, "string" ])
		if(!v.length)																throw error("EmptyString"			, [ id ])
		if(!jsl.__vars.re.url.test(v)) 						throw error("BadUrl"					, [ id ])         		
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("url+", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isString(v))												throw error("BadType" 				, [ id, "string" ])
		if(!v.length)																throw error("EmptyString"			, [ id ])
		if(!jsl.__vars.re.lurl.test(v)) 						throw error("BadUrl"					, [ id ])         		
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("s", function(v, rule, id, error, params) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isString(v))												throw error("BadType" 				, [ id, "string" ])		
		if(params && !jsl.Object.isIn(v, params))		throw error("BadValue"				, [ "[" + params.join(", ") + "]" ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("s+", function(v, rule, id, error, params) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isString(v))												throw error("BadType" 				, [ id, "string" ])
		if(!v.length)																throw error("EmptyString"			, [ id ])
		if(params && !jsl.Object.isIn(v, params))		throw error("BadValue"				, [ "[" + params.join(", ") + "]" ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("sr", function(v, rule, id, error, params) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isString(v))												throw error("BadType" 				, [ id, "string" ])		
		if(!RegExp(rule.slice(3)).test(v))					throw error("BadValue" 				, [ id ])	
	})
	//composite
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("al|i", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isArrayLike(v) && !jsl.isInteger(v))throw error("BadType"					, [ id, "[ integer | ArrayLike ]" ])			
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("al|s", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue"				, [ id ])
		if(!jsl.isArrayLike(v) && !jsl.isString(v))	throw error("BadType"					, [ id, "array-like | string" ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("b|f", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isBoolean(v) && !jsl.isFunction(v))	throw error("BadType"					, [ id, "[ boolean | function ]" ])			
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("b|i+", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isBoolean(v) && !jsl.isInteger(v))	throw error("BadType"					, [ id, "[ boolean | integer ]" ])			
		if(jsl.isInteger(v) && v < 0)								throw error("NegativeNumber"	, [ id ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("b|n+", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isBoolean(v) && !jsl.isNumber(v))		throw error("BadType"					, [ id, "[ boolean | number ]" ])			
		if(jsl.isInteger(v) && v < 0)								throw error("NegativeNumber"	, [ id ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("b|s+", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isString(v) && !jsl.isBoolean(v))		throw error("BadType"					, [ id, "[ string | boolean ]" ])			
		if(jsl.isString(v) 	&& !v.length)						throw error("EmptyString"			, [ id ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("e|f", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isError(v) && !jsl.isFunction(v))		throw error("BadType"					, [ id, "[ Error | Function ]" ])			
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("f|s+", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isString(v) && !jsl.isFunction(v))	throw error("BadType"					, [ id, "[ string | function ]" ])			
		if(jsl.isString(v) 	&& !v.length)						throw error("EmptyString"			, [ id ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("i|s+", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isString(v) && !jsl.isInteger(v))		throw error("BadType"					, [ id, "[ string | integer ]" ])			
		if(jsl.isString(v) 	&& !v.length)						throw error("EmptyString"			, [ id ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("i+|s+", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isString(v) && !jsl.isInteger(v))		throw error("BadType"					, [ id, "[ string | integer ]" ])			
		if(jsl.isString(v) 	&& !v.length)						throw error("EmptyString"			, [ id ])
		if(v < 0)																		throw error("NegativeNumber"	, [ id ])		
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("n+|s+", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isString(v) && !jsl.isNumber(v))		throw error("BadType"					, [ id, "[ string | number ]" ])			
		if(jsl.isString(v) 	&& !v.length)						throw error("EmptyString"			, [ id ])
		if(v < 0)																		throw error("NegativeNumber"	, [ id ])		
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("re|s+", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isString(v) && !jsl.isRegExp(v))		throw error("BadType"					, [ id, "[ string | RegExp ]" ])			
		if(jsl.isString(v) 	&& !v.length)						throw error("EmptyString"			, [ id ])
	})
	//-------------------------------------------------------------------------------
	jsl.defineValidationRule("w", function(v, rule, id, error) {
		if(v == null)																throw error("NullValue" 			, [ id ])
		if(!jsl.isString(v))												throw error("BadType"					, [ id, "string" ])			
		if(jsl.isString(v) 	&& !v.length)						throw error("EmptyString"			, [ id ])
		if(!(/^\w+$/).test(v))											throw error("BadValue"				, [ id ])
	})
	
	/************************************************************************************************
	*
	* Private
	*
	************************************************************************************************/
	
	//Private micro-lang runtime	
  //-------------------------------------------------------------------------------
	jsl.__mlang.array_unique = function(options) {
		try {
			var a, b, rv, data, n1, n2, inc, rule

			if(arguments.length > 1)							throw	jsl.ParamError()
			
			if(arguments.length) {
				if(options == null)									throw jsl.ParamError("NullValue:	options")
				if(!jsl.isObject(options))					throw jsl.ParamError("BadType:		options:object")
				
				if(options.right != null)
					if(!jsl.isBoolean(options.right))	throw	jsl.ParamError("BadType:options.right:boolean")
				
				if(options.rule != null)
					if(!jsl.isFunction(options.rule))	throw	jsl.ParamError("BadType:options.rule:function")
			}
			
			rv 		= []
			rule 	= options && options.rule
			
			//Right
			//-----------------------------------------------------------------------				
			if(options && options.right) 				
				for(a = this.length - 1; a >= 0; a--) {
				
					for(b = 0; b < rv.length; b++)
						if(rule ? !rule(this[a], rv[b]) : this[a] === rv[b])
							break
							
					if(b === rv.length) 
						rv.unshift(this[a])		
				}
			//Left
			//-----------------------------------------------------------------------				
			else 
				for(a = 0; a < this.length; a++) {
										
					for(b = 0; b < rv.length; b++)
						if(rule ? !rule(this[a], rv[b]) : this[a] === rv[b])
							break
							
					if(b === rv.length) 
						rv.push(this[a])		
				}		
				
			return rv
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}	
  //-------------------------------------------------------------------------------
	jsl.__mlang.array_contains = function(v) {
		try {
			if(arguments.length !== 1)	throw	jsl.ParamError()
			
			for(var a = 0, l = this.length; a < l; a++) 
				if(this[a] === v)
					break
					
			return a < l
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}	
	//-------------------------------------------------------------------------------
	jsl.__mlang.function_getName = function() {
		try {
			var txt
			
			if(arguments.length)			throw jsl.ParamError()
      if(!jsl.isFunction(this))	throw jsl.MisuseError("BadMethodCall:Function")
      			
			if(!this.__name) {
				txt					= this + ""			
				txt 				= txt.replace(/\/\*(?:[\s\S])*?\*\//g, "") 
				txt 				= txt.replace(/\/\/.*\n/g, "")						
				txt 				= txt.replace(/[\n\s]+/g, "")
				
				this.__name	= txt.match(/[\s\S]*?function([^(]*)/)[1] || "anonymous"
			}			
			return this.__name  
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.__mlang.function_getParameters = function() {
		try {
			var txt
			
			if(arguments.length)			throw jsl.ParamError()
      if(!jsl.isFunction(this))	throw jsl.TypeError("BadMethodCall:Function")
			
			//very slow -> caching
			if(!this.__params) {
				txt						= this + ""			
				txt 					= txt.replace(/\/\*(?:[\s\S])*?\*\//g, "") 
				txt 					= txt.replace(/\/\/.*\n/g, "")						
				txt 					= txt.replace(/[\n\s]+/g, "")
				//@sys: Explorer v.8 - args.callee + "" - > wrap the function into round brackets (function() {...})			
				txt 					= txt.match(/[\s\S]*?function[^(]*\(([^\)]*)\)/)[1]			
				this.__params	= txt.length ? txt.split(",") : []		
			}			
				
			return this.__params.slice()
		}
		catch(e) {
			jsl.throwError(e, this, arguments)		
		}
	}	
	//-------------------------------------------------------------------------------
	jsl.__mlang.function_getBody = function() {
		try {
			var txt
			
			if(arguments.length)			throw jsl.ParamError()
      if(!jsl.isFunction(this))	throw jsl.MisuseError("BadMethodCall:Function")
												
			//very slow -> caching
			if(!this.__body) {				
				txt					= this + ""			
				txt 				= txt.replace(/\/\*(?:[\s\S])*?\*\//g, "") 
				txt 				= txt.replace(/\/\/[^\n]*/g, "")						
				this.__body	= txt.slice(txt.indexOf("{") + 1, txt.lastIndexOf("}"))				
			}
			
			return this.__body
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}	
	